import { theme } from '@/setting'
import { themeChange } from '@/utils/common'

export default defineStore('theme', {
  state: () => {
    return {
      themeFlag: false,
      scheme: false,
      ...theme
    }
  },
  actions: {
    setThemeFlag (flag = false) {
      this.themeFlag = flag
    },
    setScheme (data) {
      this.scheme = data
      themeChange(this.primary)
    },
    setTheme (data = theme) {
      this.$patch(data)
    }
  }
})
